package demo05ObserverPattern;

/**
 * @author: WangPeng
 * @createTime: 2022/11/09 20:42
 * @description:
 * @version: v1.0
 */
public class Test {
    public static void main(String[] args) {
        User user1 = new User("aa");
        User user2 = new User("bb");
        User user3 = new User("cc");
        User user4 = new User("dd");

        WpIPublic wpIPublic = new WpIPublic();
        //添加关注用户
        wpIPublic.add(user1);
        wpIPublic.add(user2);
        wpIPublic.add(user3);
        wpIPublic.add(user4);
        //设置群发消息
        wpIPublic.setMessage("今天发工资");
        //群发
        wpIPublic.sendAll();
        System.out.println("================");
        wpIPublic.delete(user1);
        wpIPublic.sendAll();
    }
}
